package com.wingsoft.homeFlow.controller;


import com.wingsoft.common.annotation.Log;
import com.wingsoft.common.enums.BusinessType;
import com.wingsoft.common.result.Result;
import com.wingsoft.homeFlow.bo.HomeFlowTaskStepAddBo;
import com.wingsoft.homeFlow.bo.HomeFlowTaskStepExecBo;
import com.wingsoft.homeFlow.bo.HomeFlowTaskStepQo;
import com.wingsoft.homeFlow.bo.HomeFlowTaskStepUptBo;
import com.wingsoft.homeFlow.service.HomeFlowTaskStepService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/flowTaskStep")
public class HomeFlowTaskStepController {

    @Autowired
    private HomeFlowTaskStepService homeFlowTaskStepService;

    @PostMapping("/get/{id}")
    public Result<?> getVoById(@PathVariable("id") String id) {
        return Result.success(homeFlowTaskStepService.getVoById(id));
    }

    @Log(title = "门户流水线任务步骤新增", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public Result<?> add(@RequestBody HomeFlowTaskStepAddBo homeFlowTaskStepAddBo) {
        homeFlowTaskStepService.add(homeFlowTaskStepAddBo);
        return Result.success();
    }

    @Log(title = "门户流水线任务步骤更新", businessType = BusinessType.UPDATE)
    @PostMapping("/uptById")
    public Result<?> uptById(@RequestBody HomeFlowTaskStepUptBo homeFlowTaskStepUptBo) {
        homeFlowTaskStepService.uptById(homeFlowTaskStepUptBo);
        return Result.success();
    }

    @Log(title = "门户流水线任务步骤更新状态", businessType = BusinessType.UPDATE)
    @PostMapping("/uptStatusById")
    public Result<?> uptStatusById(@RequestBody HomeFlowTaskStepUptBo homeFlowTaskStepUptBo) {
        homeFlowTaskStepService.uptStatusById(homeFlowTaskStepUptBo);
        return Result.success();
    }

    @Log(title = "门户流水线任务步骤删除", businessType = BusinessType.DELETE)
    @PostMapping("/del/{id}")
    public Result<?> delById(@PathVariable("id") String id) {
        homeFlowTaskStepService.delById(id);
        return Result.success();
    }

    @PostMapping("/page")
    public Result<?> page(@RequestBody HomeFlowTaskStepQo homeFlowTaskStepQo) {
        return Result.success(homeFlowTaskStepService.page(homeFlowTaskStepQo));
    }

    @Log(title = "门户流水线任务步骤参数解析", businessType = BusinessType.UPDATE)
    @PostMapping("/parseRespVarPath")
    public Result<?> parseRespVarPath(@RequestBody HomeFlowTaskStepExecBo homeFlowTaskStepExecBo) {
        return Result.success(homeFlowTaskStepService.parseRespVarPath(homeFlowTaskStepExecBo));
    }

}
